<?php
    require_once(USER_CONTROLLER_FILE);
    if ( ! UserController::isLoggedIn()) {
        die();
    }
?>

<div class="list-style1">
    <li class="first">
        <table border="0" width="100%">
            <tr>
                <td width="30">
                    <img src="images/avatars/<?php echo stripslashes(UserController::getUserAvatar()); ?>.png">
                </td>
                <td>
                    <h4><?php echo stripslashes(UserController::getUserNickname()); ?></h4>
                </td>    
            </tr>
        </table>
        <br/>
        <table border ="0" width="100%" >
            <tr>
                <td width="16">
                    <img src="images/points.gif">
                </td> 
                <td>
                    <?php echo stripslashes(UserController::getUserPoints()); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <img src="images/win_icon.png">
                </td> 
                <td>
                    <?php echo stripslashes(UserController::getUserWinCount()); ?>
                </td>                
            </tr>
            <tr>            
                <td>
                    <img src="images/loose_icon.png">
                </td>
                <td>
                    <?php echo stripslashes(UserController::getUserLooseCount()); ?>
                </td>
                <td align="right" width="24">
                    <a href="logout.php"><img src="images/logout.png"></a>
                </td>
            </tr>      
        </table>
    </li>
    <?php
        //echo 'UserController::getUserAvatar():' . UserController::getUserAvatar();
    
    ?>
</div>
<div align="center">
        <?php
            if ( UserController::getGameID() ) {
                 echo '<a href="game.php"><img src="images/resume_btn.jpg"></a>';   // ALREADY IN GAME
            }
            else if( ! UserController::isWatingForGame() ) {
                echo '<a href="waiting_room.php"><img src="images/play_btn3.jpg"></a>'; // NOT PLAYING
            }
            else { // include AJAX script to notice when Game Started (Waiting Room)
                ?>
                <script type="text/javascript" src="js/room.js" ></script>
                <table width ="100%" border="0">
                    <tr>
                        <td><img src="images/room/globe32.gif"  alt="" /></td>
                        <td id="WaitLable">Waiting for opponent</td>
                        
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <a href="wait_cancel.php" ><img src="images/room/cancel.jpg"  alt="" /></a>
                        </td>
                    </tr>
                </table>
                
            <?php
            }
        ?>
</div>

